package com.tac.controller.mes;

import com.github.pagehelper.PageInfo;
import com.tac.common.result.Result;
import com.tac.pojo.mes.QualityInspectionStandards;
import com.tac.service.mes.QualityInspectionStandardsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/qualityInspectionStandards")
@CrossOrigin
@Api(tags = "制造执行MES--质量管理--质检标准接口")
public class QualityInspectionStandardsController {

    @Autowired
    private QualityInspectionStandardsService qualityInspectionStandardsService;

    @GetMapping("/getList")
    @ApiOperation("质检标准查询")
    public Result<PageInfo<QualityInspectionStandards>> getList(
            @RequestParam(required = false, defaultValue = "1") Integer pageNum,
            @RequestParam(required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(required = false) String materialName,
            @RequestParam(required = false) String inspectionItem,
            @RequestParam(required = false) String inspectionType
    ) {
        return qualityInspectionStandardsService.getList(pageNum, pageSize, materialName, inspectionItem, inspectionType);
    }

    @PostMapping("/save")
    @ApiOperation("质检标准添加")
    public Result save(@RequestBody QualityInspectionStandards qualityInspectionStandards) {
        return qualityInspectionStandardsService.insert(qualityInspectionStandards);
    }

    @DeleteMapping("/remove")
    @ApiOperation("质检标准删除")
    public Result remove(@RequestBody List<Integer> ids) {
        return qualityInspectionStandardsService.delete(ids);
    }

    @PutMapping("/update")
    @ApiOperation("质检标准修改")
    public Result update(@RequestBody QualityInspectionStandards qualityInspectionStandards) {
        return qualityInspectionStandardsService.update(qualityInspectionStandards);
    }

}
